//
//  ZZPRequest.h
//  DrivingWizard
//
//  Created by apple on 16/10/10.
//  Copyright © 2016年 mac. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "AFNetworking.h"
#import "MBProgressHUD.h"
#import "UIImage+animatedGIF.h"
typedef void (^transferValue) (id info,NSError* error);

typedef void (^transferNetState) (int info);

typedef void (^transNetState) (BOOL isConnect);
/**请求成功的block*/
typedef void(^requestSuccessBlock)(id dic);

/** 请求失败的Block */
typedef void(^requestFailureBlock)(NSError *error);

/** 请求任务 */
typedef NSURLSessionTask ZZPURLSessionTask;



@interface ZZPRequest : NSObject<MBProgressHUDDelegate>
@property(nonatomic,copy) MBProgressHUD *HUD;

/**检测网路状态**/
+ (void)netWorkStatus:(transferNetState)state;

+ (void)currentNetWorkStatus:(transNetState)transfer;


+ (ZZPRequest *) getWebUtil;
/**
 *JSON方式获取数据 POST
 *urlStr:获取数据的url地址
 *
 */
- (AFHTTPSessionManager *)createAFHTTPSessionManager;
//-(void)postNetworkRequestURLString:(NSString *) urlString  andParas:(id) params andTransferGottenData:(transferValue) transfer;

-(void)postNetworkRequestURLString:(NSString *) urlString  andParas:(id) params andShowHud:(BOOL)show andTransferGottenData:(transferValue) transfer;

-(void)getNetworkRequestURLString:(NSString *) urlString  andParas:(id) params andShowHud:(BOOL)show andTransferGottenData:(transferValue) transfer;


//上传图片
-(void)uploadImageRequestURLString:(NSString *) urlString  andParas:(id) params andImageArray:(NSArray *)imageArray andShowHud:(BOOL)show andTransferGottenData:(transferValue) transfer;

/**
 *JSON方式获取数据 POST
 *url_path:获取数据的url地址
 *有返回值 类型
 */
//- (ZZPURLSessionTask *)postNetworkRequestURLString:(NSString *)url_path parameters:(id)parameters success:(void (^)(id obj))success fail:(void (^)(NSError *error))fail;


-(void)postJsonNetworkRequestURLString:(NSString *) urlString  andParas:(id) params andShowHud:(BOOL)show andTransferGottenData:(transferValue) transfer;


-(void)putJsonNetworkRequestURLString:(NSString *) urlString  andParas:(id) params andShowHud:(BOOL)show andTransferGottenData:(transferValue) transfer;

-(void)deleteJsonNetworkRequestURLString:(NSString *) urlString  andParas:(id) params andShowHud:(BOOL)show andTransferGottenData:(transferValue) transfer;
/**
 *  上传图片
 *
 *  @param url        请求url
 *  @param image      要上传的文件流
 *  @param completion 文件上传成功的回调
 *  @param errorBlock 文件上传失败的回调
 *
 *  @return 请求体
 */
- (ZZPURLSessionTask *)uploadImageWithUrl:(NSString *)url WithParams:(NSDictionary*)params image:(NSData *)imageData filename:(NSString *)name mimeType:(NSString *)mimetype completion:(requestSuccessBlock)completion errorBlock:(requestFailureBlock)errorBlock;

- (ZZPURLSessionTask *)uploadImageWithUrl:(NSString *)url
                               WithParams:(NSDictionary*)params andFileArray:(NSArray *)array
                              completion:(requestSuccessBlock)completion
                               errorBlock:(requestFailureBlock)errorBlock;

-(void)openInstallRequestURLString:(NSString *) urlString  andParas:(id) params andTransferGottenData:(transferValue) transfer;

- (void)hiddenAnimation;
- (void)addAnimation;
@end



















